import { BASE_URL } from '@/config/myConfiguration.js'

// 上传文件
export function apiUpload (filePath) {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: `${BASE_URL}/driver/upload`,
			filePath,
			name: 'file',
			// 请求成功
			success: response => {
				resolve(response)
			},
			// 请求失败
			fail: err => {
				reject(err)
			}
		})
	})
}

// 上传文件
export function apiUploadRecord (filePath, orderId) {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: `${BASE_URL}/record/upload/${orderId}`,
			filePath,
			name: 'file',
			// 请求成功
			success: response => {
				resolve(response)
			},
			// 请求失败
			fail: err => {
				reject(err)
			}
		})
	})
}